home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / textra16.lha / Textra116 / Scripts / C_Scripts / Box.textra next >
Encoding:
Text File  |  1993-10-14  |  1.3 KB  |  53 lines

  1. /*
  2. ** routine to put a comment box around the selected text
  3. **   adapted from Mike Haas's 'slide' routine
  4. */
  5.  
  6. BOXWIDTH=72  /* Width of the comment box */
  7.  
  8. OPTIONS results
  9.  
  10. 'get' "select position"   /* get the select boundary, if any */
  11.  
  12. if (result == "NO SELECT") then   /* is nothing selected? */
  13.     exit   /* Then just go back */
  14.  
  15. parse var result   startx ' ' starty ' ' endx ' ' endy
  16. LinesSelected = (endy - starty)
  17.     
  18.     /* if only the 'eol' of the previous line is selected
  19.     (nothing on this line is actually included, i.e. x==0),
  20.     then don't include it.
  21.     */
  22. if (endx > 0) then  LinesSelected = LinesSelected + 1   
  23.  
  24. 'prefs' autoindent read; autoindent = result
  25.  
  26. 'unselect'
  27. 'gotoxy' 0 starty
  28. 'textn' '/' || copies('*', BOXWIDTH-1)
  29. do LinesSelected
  30.    /* At this point we are in column zero of a line to be
  31.    ** included in the comment box.  We go down a line and then left
  32.    ** one char to get to the end of the line, and pad with spaces
  33.    ** so that the '*' line up properly
  34.    */
  35.     'text' '"* "'
  36. /*
  37.     'text' '* '
  38. */
  39.     'left' 2
  40.     'down' 1
  41.     'left' 1
  42.     'get' "cursor position"
  43.     parse var result   curx cury
  44.     'text' '"' || copies(' ', BOXWIDTH-curx-1) || '*"'
  45.     'right' 1
  46. end
  47.  
  48. 'textn' copies('*', BOXWIDTH-1) || '/'
  49.  
  50. 'prefs' 'autoindent' autoindent
  51. exit
  52.  
  53.